import { createRouter, createWebHistory, type RouteRecordRaw } from 'vue-router'

export const routes:RouteRecordRaw[] =  [
  {
    path: '/login',
    component: () => import('@/views/Login/index.vue'),
  },
  {
    path: '/',
    redirect: 'home',
    component: () => import('@/views/Layout/index.vue'),
    children: [
      {
        path: 'home',
        component: () => import('@/views/home/index.vue'),
      },
      {
        path: 'user',
        component: () => import('@/views/user/index.vue'),
      },
      {
        path: 'article',
        component: () => import('@/views/article/index.vue'),
      },
      {
        path: 'publish/:id?',
        component: () => import('@/views/publish/index.vue'),
      },
      {
        path: 'updateuser',
        component: () => import('@/views/user/UpdateUser.vue'),
      }
    ]
  },
  {
    path: '/404',
    component: () => import('@/views/404.vue')
  }
]

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes
})

export default router
